package hr.ctg.domain.model;

// Generated 2007.05.02 22:50:59 by Hibernate Tools 3.2.0.b9

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.validator.NotNull;

/**
 * Telefon generated by hbm2java
 */
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "telefon")
@NamedQueries( { @NamedQuery(name = "Telefon.findByIdObjekta", query = "select t from Telefon t where t.objekt.idObjekta = ?") })
public class Telefon implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8712485631888669563L;
	private int idTelefona;
	private Objekt objekt;
	private TipTelefona tipTelefona;
	private String telefonskiBroj;
	private String kontaktIme;

	public Telefon() {
	}

	public Telefon(final int idTelefona, final Objekt objekt,
			final TipTelefona tipTelefona, final String telefonskiBroj) {
		this.idTelefona = idTelefona;
		this.objekt = objekt;
		this.tipTelefona = tipTelefona;
		this.telefonskiBroj = telefonskiBroj;
	}

	public Telefon(final int idTelefona, final Objekt objekt,
			final TipTelefona tipTelefona, final String telefonskiBroj,
			final String kontaktIme) {
		this.idTelefona = idTelefona;
		this.objekt = objekt;
		this.tipTelefona = tipTelefona;
		this.telefonskiBroj = telefonskiBroj;
		this.kontaktIme = kontaktIme;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_telefona", unique = true, nullable = false)
	@NotNull
	public int getIdTelefona() {
		return idTelefona;
	}

	public void setIdTelefona(final int idTelefona) {
		this.idTelefona = idTelefona;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_objekta", nullable = false)
	@NotNull
	public Objekt getObjekt() {
		return objekt;
	}

	public void setObjekt(final Objekt objekt) {
		this.objekt = objekt;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_tipa_telefona", nullable = false)
	@NotNull
	public TipTelefona getTipTelefona() {
		return tipTelefona;
	}

	public void setTipTelefona(final TipTelefona tipTelefona) {
		this.tipTelefona = tipTelefona;
	}

	@Column(name = "telefonski_broj", nullable = false)
	@NotNull
	public String getTelefonskiBroj() {
		return telefonskiBroj;
	}

	public void setTelefonskiBroj(final String telefonskiBroj) {
		this.telefonskiBroj = telefonskiBroj;
	}

	@Column(name = "kontakt_ime")
	public String getKontaktIme() {
		return kontaktIme;
	}

	public void setKontaktIme(final String kontaktIme) {
		this.kontaktIme = kontaktIme;
	}

}
